import { createRouter, createWebHashHistory } from 'vue-router'
import Login from '../views/login/login.vue'
import Home from '../views/home/home.vue'
import Users from '../views/home/users.vue'
import WebSocketConfig from '../views/home/WebSocketConfig.vue'
import Monitor from '../views/monitor/monitorMain.vue'

const routes = [
  // 精确匹配 #/login，指向Login页面
  { path: '/login', component: Login },
  // 精确匹配 #/home，指向Home页面
  { path: '/home', component: Home },
  // 精确匹配 #/users，指向Users页面
  { path: '/users', component: Users },
  { path: '/wsConfig', component: WebSocketConfig },
  { path: '/monitor', component: Monitor },
  // 空hash，则跳转至Login页面
  // { path: '', redirect: 'login' },
  // 未匹配，则跳转至Login页面
  { path: '/:pathMatch(.*)', redirect: 'login' }
]

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes
})

export default router
